package cn.gson.crm.model.dao;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import cn.gson.crm.model.pojo.CareType;
import cn.gson.crm.model.pojo.CustomerCare;  



public interface LLJ_CustomerCareDao extends CrudRepository<CustomerCare,Long >{
    @Query("select new cn.gson.crm.model.pojo.CustomerCare(c.ccId,c.ccContent,"
    		+ "c.ccCreationTime,c.ccExecutor,c.ccFeedback,c.ccLinkMan,"
    		+ "c.ccRemarks,c.ccTheme,c.customerName) from CustomerCare c")          
    public List<CustomerCare> findByPage(Pageable p);  
       
    @Query("select new cn.gson.crm.model.pojo.CustomerCare(c.ccId,c.ccContent,"
    		+ "c.ccCreationTime,c.ccExecutor,c.ccFeedback,c.ccLinkMan,"
    		+ "c.ccRemarks,c.ccTheme,c.customerName)"
    		+ "from CustomerCare c where c.ccTheme like ?1")         
    public List<CustomerCare> queryFindAllByCcTheme(String key);                  
      
    @Query("select count(*) from CustomerCare c where c.ccTheme like ?1")           
    public long countByCcTheme(String key);             
    
    @Query("from CustomerCare c where c.careType=?1")          
    public List<CustomerCare> queryFindAll_CC_category(CareType CC_category);  
       
    @Query("select new cn.gson.crm.model.pojo.CustomerCare(c.ccId,c.ccContent,"
    		+ "c.ccCreationTime,c.ccExecutor,c.ccFeedback,c.ccLinkMan,"
    		+ "c.ccRemarks,c.ccTheme,c.customerName) from CustomerCare c where c.ccId=?1")          
    public CustomerCare queryFindAll_CC_id(Long ccId);     
   
  
}
